home *** CD-ROM | disk | FTP | other *** search
/ Amiga Tools 4 / Amiga Tools 4.iso / tools / dfue / term 4.6(?) / extras / source / gtlayout-source.lha / gtlayout_internal.h < prev    next >
C/C++ Source or Header  |  1996-03-18  |  21KB  |  992 lines

  1. /*
  2. **    GadTools layout toolkit
  3. **
  4. **    Copyright © 1993-1996 by Olaf `Olsen' Barthel
  5. **        Freely distributable.
  6. */
  7.  
  8. #ifndef _GTLAYOUT_INTERNAL_H
  9. #define _GTLAYOUT_INTERNAL_H 1
  10.  
  11.     // Debugging stuff
  12.  
  13. #ifdef DEBUG
  14. #define DB(x)    x
  15. #else
  16. #define DB(x)    ;
  17. #endif    /* DEBUG */
  18.  
  19.     // Keep this one handy
  20.  
  21. VOID __stdargs    kprintf(STRPTR,...);
  22.  
  23. /*****************************************************************************/
  24.  
  25.  
  26.     // Keyboard qualifiers
  27.  
  28. #define QUALIFIER_SHIFT     (IEQUALIFIER_LSHIFT | IEQUALIFIER_RSHIFT)
  29. #define QUALIFIER_ALT        (IEQUALIFIER_LALT | IEQUALIFIER_RALT)
  30. #define QUALIFIER_CONTROL    (IEQUALIFIER_CONTROL)
  31.  
  32.  
  33. /*****************************************************************************/
  34.  
  35.  
  36.     // Undefine these to remove various chunks of support from this code
  37.  
  38. #ifdef _GTLAYOUT_GLOBAL_H
  39. #define DO_PASSWORD_KIND
  40. #define DO_FRACTION_KIND
  41. #define DO_GAUGE_KIND
  42. #define DO_TAPEDECK_KIND
  43. #define DO_HEXHOOK
  44. #define DO_PICKSHORTCUTS
  45. #define DO_CLONING
  46. #define DO_LEVEL_KIND
  47. #define DO_BOOPSI_KIND
  48. #define DO_MENUS
  49. #define DO_POPUP_KIND
  50. #define DO_TAB_KIND
  51. #endif    // _GTLAYOUT_GLOBAL_H
  52.  
  53.  
  54. /*****************************************************************************/
  55.  
  56.  
  57. APTR __asm AsmCreatePool(register __d0 ULONG MemFlags,register __d1 ULONG PuddleSize,register __d2 ULONG ThreshSize,register __a6 struct ExecBase *SysBase);
  58. VOID __asm AsmDeletePool(register __a0 APTR PoolHeader,register __a6 struct ExecBase *SysBase);
  59. APTR __asm AsmAllocPooled(register __a0 APTR PoolHeader,register __d0 ULONG Size,register __a6 struct ExecBase *SysBase);
  60. VOID __asm AsmFreePooled(register __a0 APTR PoolHeader,register __a1 APTR Memory,register __d0 ULONG MemSize,register __a6 struct ExecBase *SysBase);
  61.  
  62.  
  63. /*****************************************************************************/
  64.  
  65.  
  66.     // Scan an Exec list
  67.  
  68. #define SCANLIST(l,n)    for(n = (APTR)((struct MinList *)l) -> mlh_Head; \
  69.             ((struct MinNode *)n) -> mln_Succ; \
  70.             n = (APTR)((struct MinNode *)n) -> mln_Succ)
  71.  
  72.     // Scan the objects of a group
  73.  
  74. #define SCANGROUP(g,n)    for(n = (APTR)g -> Special . Group . ObjectList . mlh_Head; \
  75.             ((struct MinNode *)n) -> mln_Succ; \
  76.             n = (APTR)((struct MinNode *)n) -> mln_Succ)
  77.  
  78.     // Scan the objects of a group, only allowing active pages
  79.  
  80. #define SCANPAGE(g,n,p) for(p = 0, n = (APTR)g -> Special . Group . ObjectList . mlh_Head; \
  81.             ((struct MinNode *)n) -> mln_Succ; \
  82.             n = (APTR)((struct MinNode *)n) -> mln_Succ) \
  83.             if ((p++ == g -> Special . Group . ActivePage) || !g -> Special . Group . Paging)
  84.  
  85.     // Get an object pointer from a gadget pointer
  86.  
  87. #define GETOBJECT(g,n)    ((n = (ObjectNode *)g -> UserData) && (n -> Host == g) && (n -> PointBack == n))
  88.  
  89.  
  90. /*****************************************************************************/
  91.  
  92.  
  93. #ifdef DO_PASSWORD_KIND
  94. #define TEST_PASSWORD_KIND(n) || (n -> Type == PASSWORD_KIND)
  95. #else
  96. #define TEST_PASSWORD_KIND(n) || (FALSE)
  97. #endif
  98.  
  99. #ifdef DO_FRACTION_KIND
  100. #define TEST_FRACTION_KIND(n) || (n -> Type == FRACTION_KIND)
  101. #else
  102. #define TEST_FRACTION_KIND(n) || (FALSE)
  103. #endif
  104.  
  105.     // Is an object derived from STRING_KIND?
  106.  
  107. #define LIKE_STRING_KIND(n)    ((n -> Type == STRING_KIND) TEST_PASSWORD_KIND(n) TEST_FRACTION_KIND(n))
  108.  
  109.  
  110. /*****************************************************************************/
  111.  
  112.  
  113. #define NUMELEMENTS(s)        (sizeof(s) / sizeof((s)[0]))
  114.  
  115.  
  116. /*****************************************************************************/
  117.  
  118.  
  119. typedef char BOOLEAN;
  120.  
  121. #define INCREMENTER_KIND    42
  122. #define PICKER_KIND        43
  123. #define GROUP_KIND        44
  124.  
  125. #define LAPR_Gadget        TAG_USER+100
  126. #define LAPR_Object        TAG_USER+101
  127.  
  128. typedef struct GaugeExtra
  129. {
  130.     LONG             InfoLength;
  131.     STRPTR             InfoText;
  132.     WORD             LastPercentage;
  133.     BOOLEAN             NoTicks;
  134.     BOOLEAN             Discrete;
  135. } GaugeExtra;
  136.  
  137. typedef struct TapeDeckExtra
  138. {
  139.     struct Image        *ButtonImage;
  140.     LONG             ButtonWidth,
  141.                  ButtonHeight;
  142.     BOOLEAN          ButtonType;
  143.     BOOLEAN             Toggle;
  144.     BOOLEAN             Smaller;
  145.     BOOLEAN             Tick;
  146. } TapeDeckExtra;
  147.  
  148. typedef struct ButtonExtra
  149. {
  150.     struct Image        *ButtonImage;
  151.     STRPTR             KeyStroke;
  152.     STRPTR            *Lines;
  153.     UBYTE             LineCount;
  154.  
  155.     BOOLEAN          ReturnKey;
  156.     BOOLEAN          EscKey;
  157.     BOOLEAN          ExtraFat;
  158.     BOOLEAN             DefaultCorrection;
  159.     BOOLEAN             Smaller;
  160. } ButtonExtra;
  161.  
  162. typedef struct BarExtra
  163. {
  164.     struct ObjectNode    *Parent;
  165.     BOOLEAN          FullSize;
  166. } BarExtra;
  167.  
  168. typedef struct BoxExtra
  169. {
  170.     struct ObjectNode    *Parent;
  171.     STRPTR            *Labels;
  172.     STRPTR            *Lines;
  173.     WORD             MaxSize;
  174.     BYTE             AlignText;
  175.     BOOLEAN          DrawBox;
  176.     BOOLEAN          ReserveSpace;
  177. } BoxExtra;
  178.  
  179. typedef struct FrameExtra
  180. {
  181.     struct Hook        *RefreshHook;
  182.     UWORD             InnerWidth;
  183.     UWORD             InnerHeight;
  184.     struct Gadget         Dummy;
  185.     BOOLEAN          DrawBox;
  186.     BOOLEAN             GenerateEvents;
  187. } FrameExtra;
  188.  
  189. typedef struct PickerExtra
  190. {
  191.     struct Gadget        *Parent;    // Important: must match IncrementerExtra!
  192.     struct Image        *Image;        // Important: must match IncrementerExtra!
  193. } PickerExtra;
  194.  
  195. typedef struct IncrementerExtra
  196. {
  197.     struct Gadget        *Parent;    // Important: must match PickerExtra!
  198.     struct Image        *Image;        // Important: must match PickerExtra!
  199.     LONG             Amount;
  200. } IncrementerExtra;
  201.  
  202. typedef struct GroupExtra
  203. {
  204.     struct MinList         ObjectList;
  205.     struct ObjectNode    *ParentGroup;
  206.     LONG             MaxOffset;
  207.     LONG             MaxSize;
  208.     ULONG             ActivePage;
  209. #ifdef NOT_FUNCTIONAL
  210.     LONG             UseWidth;
  211.     LONG             UseHeight;
  212. #endif    // NOT_FUNCTIONAL
  213.     UWORD             ExtraLeft;
  214.     UWORD             ExtraTop;
  215.     UBYTE             MiscFlags;
  216.     BOOLEAN          Horizontal;
  217.     BOOLEAN          Paging;
  218.     BOOLEAN          Spread;
  219.     BOOLEAN          SameSize;
  220.     BOOLEAN          LastAttributes;
  221.     BOOLEAN          Visible;
  222.     BOOLEAN             Frame;
  223.     BOOLEAN             IndentX;
  224.     BOOLEAN             IndentY;
  225.     BOOLEAN             NoIndent;
  226. } GroupExtra;
  227.  
  228. #define GROUPF_WidthDone    (1<<0)
  229. #define GROUPF_HeightDone    (1<<1)
  230.  
  231. typedef struct ListExtra
  232. {
  233.     struct List        *Labels;
  234.     struct Gadget        *Link;
  235.     LONG             LinkID;
  236.     struct Hook        *CallBack;
  237.     LONG             AutoPageID;
  238.     struct TextAttr        *TextAttr;
  239.     STRPTR            *ExtraLabels;
  240.     UWORD             ExtraLabelWidth;
  241.     UWORD             MaxPen;
  242.     UWORD             MaxGrowX,MaxGrowY;
  243.     UWORD             MinChars,MinLines;
  244.     WORD             FixedGlyphWidth;
  245.     WORD             FixedGlyphHeight;
  246.     BOOLEAN          ReadOnly;
  247.     BOOLEAN          CursorKey;
  248.     BOOLEAN          AllocatedList;
  249.     BOOLEAN             LockSize;
  250.     BOOLEAN             SizeLocked;
  251.     BOOLEAN             ResizeX;
  252.     BOOLEAN             ResizeY;
  253.     BOOLEAN             FlushLabelLeft;
  254.     BOOLEAN             IgnoreListContents;
  255. } ListExtra;
  256.  
  257. typedef struct RadioExtra
  258. {
  259.     STRPTR            *Choices;
  260.     LONG             AutoPageID;
  261.     UWORD             LabelWidth;
  262.     UBYTE             TitlePlace;
  263.     BOOLEAN             TabKey;
  264. } RadioExtra;
  265.  
  266. typedef struct TextExtra
  267. {
  268.     STRPTR             Text;
  269.     struct Gadget        *Picker;
  270.     WORD             FrontPen;
  271.     WORD             BackPen;
  272.     UWORD             Len;
  273.     UBYTE             Justification;
  274.     BOOLEAN          Border;
  275.     BOOLEAN          CopyText;
  276.     BOOLEAN          UsePicker;
  277.     BOOLEAN             LockSize;
  278.     BOOLEAN             SizeLocked;
  279. } TextExtra;
  280.  
  281. typedef struct NumberExtra
  282. {
  283.     LONG             Number;
  284.     STRPTR             Format;
  285.     UBYTE             Justification;
  286.     BOOLEAN          Border;
  287. } NumberExtra;
  288.  
  289. typedef struct CycleExtra
  290. {
  291.     STRPTR            *Choices;
  292.     LONG             AutoPageID;
  293.     BOOLEAN             TabKey;
  294. } CycleExtra;
  295.  
  296. typedef struct PalExtra
  297. {
  298.     UBYTE            *ColourTable;
  299.     UBYTE            *TranslateBack;
  300.     struct Gadget        *Picker;
  301.     UWORD             Depth;
  302.     UWORD             NumColours;
  303.     UWORD             IndicatorWidth;
  304.     BOOLEAN          SmallPalette;
  305.     BOOLEAN             UsePicker;
  306. } PalExtra;
  307.  
  308. typedef struct SliderExtra
  309. {
  310.     STRPTR             LevelFormat;
  311.     DISPFUNC         DispFunc;
  312.     LONG             MaxLevelLen;
  313.     LONG             LevelWidth;
  314.     STRPTR             OriginalLabel;
  315.     UBYTE             LevelPlace;
  316.     BOOLEAN          FullLevelCheck;
  317. } SliderExtra;
  318.  
  319. typedef struct StringExtra
  320. {
  321.     struct LayoutHandle    *LayoutHandle;
  322.     struct Hook        *HistoryHook;
  323.     ULONG             MaxHistoryLines;
  324.     ULONG             NumHistoryLines;
  325.     struct Node        *CurrentNode;
  326.  
  327.     STRPTR             String;
  328.     LONG             MaxChars;
  329.     struct Hook        *EditHook;
  330.     struct Hook        *ValidateHook;
  331.     struct Gadget        *Picker;
  332.     STRPTR             Backup;
  333.     STRPTR             RealString;
  334.     STRPTR             Original;
  335.     LONG             LinkID;
  336.  
  337.     UBYTE             Justification;
  338.     BOOLEAN          LastGadget;
  339.     BOOLEAN          UsePicker;
  340.     BOOLEAN             Activate;
  341. } StringExtra;
  342.  
  343. typedef struct IntegerExtra
  344. {
  345.     struct LayoutHandle    *LayoutHandle;
  346.     struct Hook        *HistoryHook;
  347.     ULONG             MaxHistoryLines;
  348.     ULONG             NumHistoryLines;
  349.     struct Node        *CurrentNode;
  350.  
  351.     struct Gadget        *LeftIncrementer;
  352.     struct Gadget        *RightIncrementer;
  353.  
  354.     struct Hook        *IncrementerHook;
  355.  
  356.     LONG             Number;
  357.     LONG             MaxChars;
  358.     struct Hook        *EditHook;
  359.     struct Hook        *ValidateHook;
  360.  
  361.     UBYTE             Justification;
  362.     BOOLEAN          LastGadget;
  363.     BOOLEAN          UseIncrementers;
  364.     BOOLEAN             CustomHook;
  365.     BOOLEAN             Activate;
  366. } IntegerExtra;
  367.  
  368. typedef struct ScrollerExtra
  369. {
  370.     WORD             Visible;
  371.     WORD             ArrowSize;
  372.     BOOLEAN          RelVerify;
  373.     BOOLEAN             Immediate;
  374.     BOOLEAN             Arrows;
  375.     BOOLEAN             Vertical;
  376.     BOOLEAN             Thin;
  377. } ScrollerExtra;
  378.  
  379. typedef struct LevelExtra
  380. {
  381.     struct LayoutHandle    *Handle;
  382.     LONG             Min,
  383.                  Max,
  384.                  Level,
  385.                  Plus;
  386.     STRPTR             LevelFormat;
  387.     struct Image        *LevelImage;
  388.     DISPFUNC         DispFunc;
  389.     LONG             MaxLevelWidth,
  390.                  MidOffset,
  391.                  LevelPlace;
  392.     struct Hook         CustomHook;
  393.     UBYTE             FormatBuffer[80];
  394.     BOOLEAN             FullLevelCheck;
  395. } LevelExtra;
  396.  
  397. typedef struct BOOPSIExtra
  398. {
  399.     struct Library        *ClassBase;
  400.     Class            *ClassInstance;
  401.     STRPTR             ClassName;
  402.     STRPTR             ClassLibraryName;
  403.     struct TagItem        *ClassTags;
  404.     ULONG             TagCurrent,
  405.                  TagTextAttr,
  406.                  TagDrawInfo,
  407.                  TagLink,
  408.                  TagScreen;
  409.     LONG             Link;
  410.     struct ObjectNode    *Parent;
  411.     struct Hook        *ActivateHook;
  412.     WORD             ExactWidth,
  413.                  ExactHeight;
  414.     WORD             RelFontHeight;
  415.     BOOLEAN             FullWidth;
  416.     BOOLEAN             FullHeight;
  417. } BOOPSIExtra;
  418.  
  419. typedef struct PopupExtra
  420. {
  421.     STRPTR            *Choices;
  422.     LONG             AutoPageID;
  423.     BOOLEAN             TabKey;
  424.     BOOLEAN             CentreActive;
  425. } PopupExtra;
  426.  
  427. typedef struct TabExtra
  428. {
  429.     STRPTR            *Choices;
  430.     LONG             AutoPageID;
  431.     struct ObjectNode    *Parent;
  432.     BOOLEAN             TabKey;
  433.     BOOLEAN             FullWidth;
  434. } TabExtra;
  435.  
  436. typedef struct ObjectNode
  437. {
  438.     struct MinNode         Node;
  439.     struct Gadget        *Host;
  440.     struct ObjectNode    *PointBack;
  441.     STRPTR             Label;
  442.     LONG             ID;
  443.     LONG             Min;
  444.     LONG             Max;
  445.     LONG             Current;
  446.     APTR             Storage;
  447.  
  448.     UWORD             Left;
  449.     UWORD             Top;
  450.     UWORD             Width;
  451.     UWORD             Height;
  452.     UWORD             LabelWidth;
  453.     UWORD             Lines;
  454.     UWORD             Chars;
  455.     WORD             ExtraSpace;
  456.     WORD             LabelChars;
  457.  
  458.     UBYTE             Type;
  459.     BYTE             LabelPlace;
  460.     UBYTE             Key;
  461.     UBYTE             StorageType;
  462.     BYTE             Pad0;
  463.     BOOLEAN          Disabled;
  464.     BOOLEAN          NoKey;
  465.     BOOLEAN          HighLabel;
  466.     BOOLEAN          GroupIndent;
  467.     BOOLEAN          PageSelector;
  468.  
  469.     union
  470.     {
  471.         GaugeExtra        Gauge;
  472.         TapeDeckExtra        TapeDeck;
  473.         ButtonExtra        Button;
  474.         BarExtra        Bar;
  475.         BoxExtra        Box;
  476.         FrameExtra        Frame;
  477.         PickerExtra        Picker;
  478.         IncrementerExtra    Incrementer;
  479.         GroupExtra        Group;
  480.         ListExtra        List;
  481.         RadioExtra        Radio;
  482.         TextExtra        Text;
  483.         NumberExtra        Number;
  484.         CycleExtra        Cycle;
  485.         PalExtra        Palette;
  486.         SliderExtra        Slider;
  487.         StringExtra        String;
  488.         IntegerExtra        Integer;
  489.         ScrollerExtra        Scroller;
  490.         LevelExtra        Level;
  491.         BOOPSIExtra        BOOPSI;
  492.         PopupExtra        Popup;
  493.         TabExtra        Tab;
  494.     } Special;
  495. } ObjectNode;
  496.  
  497. typedef struct LayoutHandle
  498. {
  499.         // WARNING: Beginning of this structure must match the definition in gtlayout.h!
  500.  
  501.     struct Screen        *Screen;
  502.     struct DrawInfo     *DrawInfo;
  503.     struct Window        *Window;
  504.     APTR             VisualInfo;
  505.     struct Image        *AmigaGlyph;
  506.     struct Image        *CheckGlyph;
  507.     APTR             UserData;
  508.     struct Menu        *Menu;
  509.  
  510.         // End of public part
  511.  
  512.     struct Screen        *PubScreen;
  513.     struct MsgPort        *MsgPort;
  514.     struct Gadget        **GadgetArray;
  515.     struct Gadget        *Previous;
  516.     struct Gadget        *List;
  517.     ULONG             IDCMP;
  518.     ULONG             WA_ScreenTag;
  519.     BOOL             UnlockPubScreen;
  520.     BOOL             Pad1;
  521.  
  522.         // BOOPSI support
  523.  
  524.     Object            *BOOPSIPrevious;
  525.     Object            *BOOPSIList;
  526.  
  527.         // Incrementers
  528.  
  529.     ObjectNode        *ActiveIncrementer;
  530.     WORD             IncrementerCountdown;
  531.     WORD             IncrementerAccelerate;
  532.     LONG             IncrementerIncrement;
  533.  
  534.         // Frames
  535.  
  536.     ObjectNode        *ActiveFrame;
  537.  
  538.         // Cached from DrawInfo structure
  539.  
  540.     UWORD             TextPen;
  541.     UWORD             BackgroundPen;
  542.     UWORD             ShadowPen;
  543.     UWORD             ShinePen;
  544.  
  545.     UWORD             AspectX;
  546.     UWORD             AspectY;
  547.  
  548.         // Double-click support
  549.  
  550.     ULONG             ClickSeconds;
  551.     ULONG             ClickMicros;
  552.     ObjectNode        *ClickObject;
  553.  
  554.     struct Hook        *LocaleHook;
  555.     struct TextAttr     *TextAttr;
  556.     struct TextAttr     *InitialTextAttr;
  557.     struct TTextAttr     CopyTextAttr;
  558.     struct RastPort      RPort;
  559.  
  560.     APTR             Pool;
  561.  
  562.     UWORD             GlyphWidth;
  563.     UWORD             GlyphHeight;
  564.  
  565.     UWORD             InterWidth;
  566.     UWORD             InterHeight;
  567.  
  568.     LONG             Count;
  569.  
  570.     LONG             Index;
  571.  
  572.     ObjectNode        *TopGroup;
  573.     ObjectNode        *CurrentGroup;
  574.     ObjectNode        *EscKey;
  575.     ObjectNode        *ReturnKey;
  576.     ObjectNode        *CursorKey;
  577.     ObjectNode        *GrowView;
  578.     ObjectNode        *ResizeView;
  579.     ObjectNode        *TabKey;
  580.     ObjectNode        *ActiveString;
  581. #ifdef DO_FRACTION_KIND
  582.     struct Hook         FracEditHook;
  583. #endif
  584. #ifdef DO_PASSWORD_KIND
  585.     struct Hook         PasswordEditHook;
  586. #endif
  587. #ifdef DO_HEXHOOK
  588.     struct Hook         HexEditHook;
  589. #endif
  590.     struct Hook         DefaultEditHook;
  591.     struct Hook        *StandardEditHook;
  592.  
  593.     struct Hook         BackfillHook;
  594.     struct RastPort         BackfillRastPort;
  595.  
  596. #ifdef DO_LEVEL_KIND
  597.     ObjectNode        *CurrentLevel;
  598. #endif    /* DO_LEVEL_KIND */
  599.  
  600.     struct TTextAttr     FixedFont;
  601.  
  602.     struct LayoutHandle    *PointBack;
  603.  
  604.     LONG             GroupID;
  605.  
  606. #ifdef DO_PICKSHORTCUTS
  607.     UBYTE             Keys[256];
  608. #endif
  609.  
  610.     struct Window        *Parent;        // Parent of this window
  611.     struct Hook        *HelpHook;        // Hook to call when help key is pressed
  612.     LONG             MaxPen;
  613.  
  614.     WORD             SizeWidth;
  615.     WORD             SizeHeight;
  616.  
  617.     BOOLEAN             SizeVerified;
  618.     BOOLEAN          AutoRefresh;
  619.     BOOLEAN          CloseFont;
  620.     BOOLEAN          Failed;
  621.     BOOLEAN          Rescaled;
  622.     BOOLEAN          AutoActivate;
  623.     BOOLEAN          MoveToWindow;
  624.     BOOLEAN             NeedDelay;
  625.     BOOLEAN             RawKeyFilter;
  626.     BOOLEAN             FlushLeft;
  627.     BOOLEAN             FlushTop;
  628.     BOOLEAN             BlockParent;
  629.     BOOLEAN             ExitFlush;
  630.     BOOLEAN             NoKeys;
  631.  
  632. #ifdef DO_CLONING
  633.     BOOLEAN          CloningPermitted;    // Genetic engineering?
  634.     BOOLEAN          ExactClone;        // Make an exact copy, i.e. preserve all colours
  635.     BOOLEAN             SimpleClone;        // Just a simple clone, please
  636.     BYTE             Pad0;
  637.     struct CloneExtra    *CloneExtra;        // Screen cloning information
  638. #endif
  639. } LayoutHandle;
  640.  
  641. #define PHANTOM_GROUP_ID    -10000    // Phantom groups, i.e those without proper
  642.                     // IDs start with this ID
  643.  
  644. /*****************************************************************************/
  645.  
  646.  
  647.     // Window locking
  648.  
  649. typedef struct LockNode
  650. {
  651.     struct MinNode         MinNode;
  652.     struct Window        *Window;
  653.     LONG             Count;
  654.     ULONG             OldIDCMPFlags;
  655.     struct Requester     Requester;
  656.     LONG             MinWidth;
  657.     LONG             MinHeight;
  658.     LONG             MaxWidth;
  659.     LONG             MaxHeight;
  660. } LockNode;
  661.  
  662.  
  663. /*****************************************************************************/
  664.  
  665.  
  666.     // Image class extension
  667.  
  668. typedef struct ImageInfo
  669. {
  670.     STRPTR            *Lines;        // Text lines
  671.     STRPTR             KeyStroke;    // Points to char that acts as keystroke identifier
  672.  
  673.     STRPTR             Label;        // Single label if any
  674.  
  675.     struct TextFont        *Font;        // Open font if any
  676.  
  677.     UWORD             ImageType;    // Type
  678.  
  679.     UWORD             GlyphWidth;    // Size
  680.     UWORD             GlyphHeight;
  681.  
  682.     UWORD             LineCount;    // Number of lines below
  683.  
  684.     BOOLEAN             Emboss;    // Emboss the bevel box
  685. } ImageInfo;
  686.  
  687.     // Image class extension types
  688.  
  689. #define IIA_ImageType    (TAG_USER+739)
  690. #define IIA_GlyphWidth    (TAG_USER+740)
  691. #define IIA_GlyphHeight    (TAG_USER+741)
  692. #define IIA_Lines    (TAG_USER+742)
  693. #define IIA_LineCount    (TAG_USER+743)
  694. #define IIA_KeyStroke    (TAG_USER+744)
  695. #define IIA_Emboss    (TAG_USER+745)
  696. #define IIA_Label    (TAG_USER+746)
  697. #define IIA_Font    (TAG_USER+747)
  698.  
  699.     // Supported image class extension types
  700.  
  701. enum
  702. {
  703.     IMAGECLASS_PICKER,
  704.     IMAGECLASS_LEFTINCREMENTER,
  705.     IMAGECLASS_RIGHTINCREMENTER,
  706.     IMAGECLASS_BACKWARD,
  707.     IMAGECLASS_FORWARD,
  708.     IMAGECLASS_PREVIOUS,
  709.     IMAGECLASS_NEXT,
  710.     IMAGECLASS_RECORD,
  711.     IMAGECLASS_PLAY,
  712.     IMAGECLASS_STOP,
  713.     IMAGECLASS_PAUSE,
  714.     IMAGECLASS_REWIND,
  715.     IMAGECLASS_EJECT,
  716.     IMAGECLASS_MULTILINEBUTTON
  717. };
  718.  
  719.  
  720. /*****************************************************************************/
  721.  
  722.  
  723.     // Level image class
  724.  
  725. typedef struct LevelImageInfo
  726. {
  727.     LONG         Position;    // Position of knob on level body
  728.     LONG         Max;        // Maximum value
  729.     LONG         Current;    // Current value
  730.  
  731.     UWORD        *Pens;        // We don't really need the DrawInfo, just the pens
  732.  
  733.     struct BitMap    *Knob[2];    // BitMaps of the knob
  734.  
  735.     WORD         KnobWidth;    // Width of knob (actually half of it)
  736.     WORD         KnobTop;    // Distance from knob to level body
  737.     WORD         LevelHeight;    // Height of level body
  738. } LevelImageInfo;
  739.  
  740.     // Level class control tags
  741.  
  742. #define LVIA_Current    (TAG_USER+0xF000)    // Current value
  743. #define LVIA_Max    (TAG_USER+0xF001)    // Maximum value
  744. #define LVIA_DrawInfo    (TAG_USER+0xF002)    // Pens, etc.
  745. #define LVIA_Position    (TAG_USER+0xF003)    // Position of knob
  746. #define LVIA_KnobWidth    (TAG_USER+0xF004)    // Width of knob
  747. #define LVIA_FontWidth    (TAG_USER+0xF005)    // Reference font width
  748. #define LVIA_Screen    (TAG_USER+0xF006)    // Screen to draw this image on
  749.  
  750.  
  751. /*****************************************************************************/
  752.  
  753.  
  754. enum
  755. {
  756.     STORAGE_BYTE,STORAGE_UBYTE,
  757.     STORAGE_WORD,STORAGE_UWORD,
  758.     STORAGE_LONG,STORAGE_ULONG,
  759.     STORAGE_STRPTR
  760. };
  761.  
  762.  
  763. /*****************************************************************************/
  764.  
  765.  
  766.     // A single colour in 96 bit precision
  767.  
  768. struct ColourTriplet
  769. {
  770.     ULONG            Red;        // 32 bits each
  771.     ULONG            Green;
  772.     ULONG            Blue;
  773. };
  774.  
  775.     // A colour table ready to submit to LoadRGB32
  776.  
  777. struct ColourRecord
  778. {
  779.     UWORD            NumColours;    // Number of colours in this chunk
  780.     UWORD            FirstColour;    // First colour entry to set
  781.  
  782.     struct ColourTriplet    Triplets[0];    // Table entries
  783.  
  784.     WORD            Arnold;     // Array terminator, needs to be set to zero
  785. };
  786.  
  787.     // Screen reproduction
  788.  
  789. struct CloneExtra
  790. {
  791.     struct Screen        *Screen;
  792.     LONG            *Pens;
  793.     UWORD            *ScreenPens;
  794.     UWORD             MinWidth,
  795.                  MinHeight,
  796.                  MaxWidth,
  797.                  MaxHeight,
  798.                  TotalPens;
  799.     UBYTE             Depth;
  800.     struct IBox         Bounds;
  801. };
  802.  
  803.  
  804. /*****************************************************************************/
  805.  
  806.  
  807. #define ITEMF_HasSub    (1 << 0)        // Next item is a subitem
  808. #define ITEMF_FirstSub    (1 << 1)        // This is the first subitem
  809. #define ITEMF_IsSub    (1 << 2)        // This is a subitem
  810. #define ITEMF_LastItem    (1 << 3)        // This is the last item
  811. #define ITEMF_IsBar    (1 << 4)        // This is a separator bar
  812. #define ITEMF_Command    (1 << 5)        // This item has a long command key sequence
  813.  
  814. typedef struct ItemNode
  815. {
  816.     struct MinNode     Node;
  817.     struct MenuItem     Item;
  818.     APTR         UserData;
  819.     ULONG         ID;            // Item ID
  820.  
  821.     STRPTR         ExtraLabel;        // For long command sequence labels
  822.     UWORD         Flags;            // Flag bits as defined above
  823.     WORD         Left,            // Actual left edge
  824.              Top;            // Actual top edge
  825.     WORD         Width;            // Actual width
  826.  
  827.     UWORD         MenuCode;        // Intuition menu code
  828.  
  829.     ULONG         Qualifier;        // Message qualifier
  830.     UWORD         Code;            // Message code
  831.     UBYTE         Char;            // ASCII code
  832. } ItemNode, *pItemNode;
  833.  
  834. typedef struct MenuNode
  835. {
  836.     struct MinNode     Node;
  837.     struct Menu     Menu;
  838.     APTR         UserData;
  839.     ULONG         ID;            // Item ID
  840.  
  841.     WORD         Width;            // Actual width
  842.  
  843.     UWORD         MenuCode;        // Intuition menu code
  844. } MenuNode, *pMenuNode;
  845.  
  846. typedef struct RootMenu
  847. {
  848.     APTR             Pool;        // Memory allocation
  849.     struct TextFont        *Font;        // Preferred item font
  850.     struct TextAttr        *TextAttr;    // What goes into the single items
  851.     struct TTextAttr     BoldAttr;    // Same as above, just in boldface
  852.     struct DrawInfo        *DrawInfo;    // Screen drawing info
  853.     struct Screen        *Screen;    // The screen we are building the menu for
  854.     struct RastPort         RPort;        // Dummy RastPort for font measuring
  855.  
  856.     WORD             ItemHeight;    // Default item height
  857.     UWORD             TextPen;    // Text rendering pen
  858.  
  859.     ULONG             CheckWidth,    // Size of the checkmark glyph
  860.                  CheckHeight,
  861.                  AmigaWidth,    // Size of the Amiga glyph
  862.                  AmigaHeight;
  863.  
  864.     struct MinList         MenuList;    // List of menus
  865.     struct MinList         ItemList;    // List of menu items
  866.  
  867.     LayoutHandle        *Handle;    // Layout handle if any
  868.     struct Hook        *LocaleHook;    // Localization, if no handle is provided
  869.  
  870.     struct MinNode         Node;        // The initial menu all the data is tied to
  871.     struct Menu         Menu;
  872.     APTR             UserData;
  873.     ULONG             ID;
  874.     WORD             Width;
  875.     UWORD             MenuCode;
  876. } RootMenu, *pRootMenu;
  877.  
  878.  
  879. /*****************************************************************************/
  880.  
  881.  
  882. typedef struct PopInfo
  883. {
  884.     struct CheckGlyph *CheckGlyph;
  885.  
  886.     LONG         MaxLen;
  887.     LONG         MaxWidth;
  888.  
  889.     struct Window    *Window;
  890.     struct TextFont    *Font;
  891.  
  892.     LONG         TopMost;
  893.  
  894.     LONG         LastDrawn;
  895.     LONG         LastLabelDrawn;
  896.  
  897.     STRPTR        *Labels;
  898.     LONG         NumLabels;
  899.     LONG         Active;
  900.     LONG         InitialActive;
  901.     UWORD         ActiveLen;
  902.  
  903.     UWORD         MarkLeft;
  904.     UWORD         MarkWidth;
  905.  
  906.     UWORD         LabelLeft;
  907.     UWORD         LabelTop;
  908.  
  909.     UWORD         LineTop;
  910.  
  911.     UWORD         ArrowTop;
  912.     UWORD         ArrowWidth;
  913.     UWORD         ArrowHeight;
  914.  
  915.     UWORD         PopLeft;
  916.     UWORD         PopWidth;
  917.  
  918.     UWORD         BoxLeft,BoxTop,
  919.              BoxWidth,BoxHeight;
  920.  
  921.     UWORD         BoxLines;
  922.  
  923.     UWORD         SingleWidth,
  924.              SingleHeight;
  925.  
  926.     UWORD         MenuText,MenuBack;
  927.     UWORD         MenuTextSelect,MenuBackSelect;
  928.  
  929.     UBYTE         Flags;
  930.     BOOLEAN         Blocked;
  931.     BOOLEAN         CentreActive;
  932. } PopInfo;
  933.  
  934. #define PIA_Labels        (TAG_USER+0x80000)
  935. #define PIA_Active        (TAG_USER+0x80001)
  936. #define PIA_Font        (TAG_USER+0x80002)
  937. #define PIA_Highlight        (TAG_USER+0x80003)
  938. #define PIA_CentreActive    (TAG_USER+0x80004)
  939.  
  940.  
  941. /*****************************************************************************/
  942.  
  943.  
  944. typedef struct TabEntry
  945. {
  946.     struct BitMap    *BitMap;
  947.     UWORD         Left;
  948. } TabEntry;
  949.  
  950. typedef struct TabInfo
  951. {
  952.     struct BitMap    *BitMap;
  953.     struct RastPort     RPort;
  954.     PLANEPTR     Mask;
  955.  
  956.     TabEntry    *Tabs;
  957.     WORD         Count;
  958.     WORD         Current;
  959.     WORD         Initial;
  960.  
  961.     UWORD         Thick;
  962.     UWORD         TabWidth;
  963.     UWORD         TabHeight;
  964.  
  965.     WORD         Offset;
  966. } TabInfo;
  967.  
  968. #define TIA_Labels    (TAG_USER+0x90000)
  969. #define TIA_Font    (TAG_USER+0x90001)
  970. #define TIA_Screen    (TAG_USER+0x90002)
  971. #define TIA_Index    (TAG_USER+0x90003)
  972. #define TIA_DrawInfo    (TAG_USER+0x90004)
  973. #define TIA_SizeType    (TAG_USER+0x90005)
  974.  
  975.  
  976. /*****************************************************************************/
  977.  
  978.  
  979. struct CheckGlyph
  980. {
  981.     UWORD         Width,
  982.              Height;
  983.     struct BitMap    *Plain;
  984.     struct BitMap    *Selected;
  985. };
  986.  
  987.  
  988. /*****************************************************************************/
  989.  
  990.  
  991. #endif
  992.